# 0
# 可重复利用

# 1
# 目测会报错,构造方法不返回任何对象

# 2
# 会重写属性及方法
# class Par:
#     name = 'par'
#
# class Child(Par):
#     name = 'haha'
#
# c = Child()
# print(c.name)



# 3
# 屏蔽父类方法


# 5
# 多重继承缺点,会多次调用基类,导致代码难以控制

# 动手吧0
import math as m


class Point:
    __x = 0
    __y = 0

    def __init__(self, x: int, y: int):
        super().__init__()
        self.__x = x
        self.__y = y

    def getX(self):
        return self.__x

    def getY(self):
        return self.__y


class Line:
    def setLine(self, a: Point, b: Point):
        self.pointA = a
        self.pointB = b

    def getLine(self):
        return m.hypot(self.pointA.getX() - self.pointB.getX(),
                       self.pointA.getY() - self.pointB.getY())
    def getPointA(self):
        return self.pointA
    def getPointB(self):
        return self.pointB

a = Point(0, 3)
b = Point(0, 4)


print(b.getY())
l = Line()
l.setLine(a=a, b=b)
print(l.getLine())

print(l.getPointA().__dict__)
